﻿using Comm100.Framework.Domain.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bot.Domain.Entities;
using Bot.Domain.Interfaces;
using Bot.Domain.Bo;
using Castle.Windsor;

namespace Bot.Domain.Categories.Service
{
    public class ImageDomainService : IImageDomainService
    {
        private IWindsorContainer _container;
        private readonly IRepository<Guid, Image> _repository;

        public ImageDomainService(IRepository<Guid, Image> repository, IWindsorContainer container)
        {
            this._repository = repository;
            this._container = container;
        }

        public Image Create(Image category)
        {
            return _repository.Create(category);
        }

        public Image Get(Guid id)
        {
            return _repository.Get(id);
        }

        public Image Update(ImageUpdateBo bo)
        {
            Image image = _repository.Get(bo.Id);
            image.Id = bo.Id;
            image.Name = bo.Name;
            image.Content = bo.Content;

            _repository.Update(image);

            return image;

        }

        public IEnumerable<Image> List()
        {
            return _repository.ListAll();
        }

        public void Delete(Guid id)
        {
            Image image = _repository.Get(id);

            _repository.Delete(image);

        }
    }
}
